/*
Navicat MySQL Data Transfer

Source Server         : localhost_3306
Source Server Version : 80027
Source Host           : localhost:3306
Source Database       : electronics_db

Target Server Type    : MYSQL
Target Server Version : 80027
File Encoding         : 65001

Date: 2022-06-19 15:44:55
*/

SET FOREIGN_KEY_CHECKS=0;

-- ----------------------------
-- Table structure for car
-- ----------------------------
DROP TABLE IF EXISTS `car`;
CREATE TABLE `car` (
  `chrid` int NOT NULL AUTO_INCREMENT,
  `cid` int NOT NULL,
  `pname` varchar(32) NOT NULL,
  `price` decimal(10,2) NOT NULL,
  `onumber` int NOT NULL,
  `money` decimal(10,2) NOT NULL,
  `odate` date DEFAULT NULL,
  PRIMARY KEY (`chrid`),
  KEY `fk_car_info` (`pname`),
  KEY `fk_car_client` (`cid`),
  CONSTRAINT `fk_car_client` FOREIGN KEY (`cid`) REFERENCES `client` (`cid`),
  CONSTRAINT `fk_car_info` FOREIGN KEY (`pname`) REFERENCES `product_info` (`pname`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb3;

-- ----------------------------
-- Records of car
-- ----------------------------
INSERT INTO `car` VALUES ('7', '1', '华人牌手机傻妞', '9999.90', '1', '9999.90', '2022-06-19');
INSERT INTO `car` VALUES ('8', '1', '华人牌手机太子', '3999.90', '1', '3999.90', '2022-06-19');
INSERT INTO `car` VALUES ('11', '4', '菠萝手机note9 Plus', '5999.90', '1', '5999.90', '2022-06-19');

-- ----------------------------
-- Table structure for client
-- ----------------------------
DROP TABLE IF EXISTS `client`;
CREATE TABLE `client` (
  `cid` int NOT NULL AUTO_INCREMENT,
  `username` varchar(32) NOT NULL,
  `password` varchar(32) NOT NULL,
  `phone` varchar(32) DEFAULT NULL,
  `sex` char(1) DEFAULT NULL,
  `text` varchar(300) DEFAULT NULL,
  PRIMARY KEY (`cid`),
  UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb3;

-- ----------------------------
-- Records of client
-- ----------------------------
INSERT INTO `client` VALUES ('1', 'tom', '123', '18727563655', '男', '一只会抓老鼠的好猫！');
INSERT INTO `client` VALUES ('2', 'jasonli', '123', '18727563655', '男', '湖工最帅的男人！');
INSERT INTO `client` VALUES ('3', 'jerry', '123', '18727563655', '男', '一只会抓猫的好老鼠！');
INSERT INTO `client` VALUES ('4', 'lisa', '123', '18727563655', '女', 'blackpink主舞');

-- ----------------------------
-- Table structure for order_info
-- ----------------------------
DROP TABLE IF EXISTS `order_info`;
CREATE TABLE `order_info` (
  `oid` int NOT NULL AUTO_INCREMENT,
  `cid` int NOT NULL,
  `pname` varchar(32) NOT NULL,
  `onumber` int NOT NULL,
  `money` decimal(10,2) NOT NULL,
  `odate` date DEFAULT NULL,
  PRIMARY KEY (`oid`),
  KEY `fk_order_info` (`pname`),
  KEY `fk_order_client` (`cid`),
  CONSTRAINT `fk_order_client` FOREIGN KEY (`cid`) REFERENCES `client` (`cid`),
  CONSTRAINT `fk_order_info` FOREIGN KEY (`pname`) REFERENCES `product_info` (`pname`)
) ENGINE=InnoDB AUTO_INCREMENT=492432761 DEFAULT CHARSET=utf8mb3;

-- ----------------------------
-- Records of order_info
-- ----------------------------
INSERT INTO `order_info` VALUES ('492432744', '1', '砖头手机', '10', '49999.00', '2022-06-12');
INSERT INTO `order_info` VALUES ('492432745', '1', '华人牌手机傻妞', '10', '99999.00', '2022-06-12');
INSERT INTO `order_info` VALUES ('492432746', '1', '砖头手机', '10', '49999.00', '2022-06-12');
INSERT INTO `order_info` VALUES ('492432747', '1', '砖头手机', '14', '69998.59', '2022-06-12');
INSERT INTO `order_info` VALUES ('492432748', '1', '砖头手机', '10', '49999.00', '2022-06-12');
INSERT INTO `order_info` VALUES ('492432749', '1', '砖头手机', '4', '19999.60', '2022-06-19');
INSERT INTO `order_info` VALUES ('492432750', '1', '华人牌手机傻妞', '1', '9999.90', '2022-06-19');
INSERT INTO `order_info` VALUES ('492432751', '1', '华人牌手机傻妞', '10', '99999.00', '2022-06-12');
INSERT INTO `order_info` VALUES ('492432752', '1', '菠萝手机note9 Plus', '1', '5999.90', '2022-06-19');
INSERT INTO `order_info` VALUES ('492432753', '1', '华人牌手机傻妞', '1', '9999.90', '2022-06-19');
INSERT INTO `order_info` VALUES ('492432754', '1', '华人牌手机傻妞', '1', '9999.90', '2022-06-19');
INSERT INTO `order_info` VALUES ('492432755', '1', '华人牌手机傻妞', '1', '9999.90', '2022-06-19');
INSERT INTO `order_info` VALUES ('492432756', '4', '华人牌手机太子', '1', '3999.90', '2022-06-19');
INSERT INTO `order_info` VALUES ('492432757', '4', '华人牌手机傻妞', '1', '9999.90', '2022-06-19');
INSERT INTO `order_info` VALUES ('492432758', '4', '砖头手机', '1', '4999.90', '2022-06-19');
INSERT INTO `order_info` VALUES ('492432759', '4', '菠萝手机note9 Plus', '1', '5999.90', '2022-06-19');
INSERT INTO `order_info` VALUES ('492432760', '4', '菠萝手机note9 Plus', '1', '5999.90', '2022-06-19');

-- ----------------------------
-- Table structure for product_info
-- ----------------------------
DROP TABLE IF EXISTS `product_info`;
CREATE TABLE `product_info` (
  `pid` int NOT NULL AUTO_INCREMENT,
  `pcontent` varchar(200) DEFAULT NULL,
  `pname` varchar(32) NOT NULL,
  `price` decimal(10,2) NOT NULL,
  `pimage` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT 'images/demo.jpg',
  `pnumber` int NOT NULL,
  `tid` int NOT NULL,
  `pdate` date DEFAULT NULL,
  PRIMARY KEY (`pid`),
  UNIQUE KEY `pname` (`pname`),
  KEY `fk_info_type` (`tid`),
  CONSTRAINT `fk_info_type` FOREIGN KEY (`tid`) REFERENCES `product_type` (`tid`)
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8mb3;

-- ----------------------------
-- Records of product_info
-- ----------------------------
INSERT INTO `product_info` VALUES ('11', '菠萝手机，手机中的战斗机！', '菠萝手机note9 Plus', '5999.90', 'images/demo.jpg', '100', '1', '2022-06-16');
INSERT INTO `product_info` VALUES ('12', '砸人超级痛，可打架，可打电话！', '砖头手机', '4999.90', 'images/demo1.jpg', '1000', '1', '2022-06-16');
INSERT INTO `product_info` VALUES ('13', '2060年华人牌手机傻妞为你服务！', '华人牌手机傻妞', '9999.90', 'images/demo2.jpg', '1000', '1', '2022-06-17');
INSERT INTO `product_info` VALUES ('14', '华人牌手机傻妞的盗版', '华人牌手机太子', '3999.90', 'images/demo3.jpg', '100', '1', '2022-06-17');
INSERT INTO `product_info` VALUES ('15', '又能打电话，又能锤人！', '锤子手机', '6999.90', 'images/demo4.jpg', '200', '1', '2022-06-17');
INSERT INTO `product_info` VALUES ('16', '大菠萝手机，一个好手机', '大菠萝手机', '9999.90', 'images/demo5.jpg', '300', '1', '2022-06-17');
INSERT INTO `product_info` VALUES ('17', 'jasonli亲手打造的电脑，可以依靠它变声为假面骑士jasonli', 'jasonli911', '9999.99', 'images/demo6.jpg', '1', '2', '2022-06-10');
INSERT INTO `product_info` VALUES ('18', '拥有这部电视可以变身成为假面骑士喜羊羊', '喜羊羊电视', '3999.90', 'images/demo7.jpg', '800', '3', '2022-06-15');
INSERT INTO `product_info` VALUES ('19', '拥有这部电视可以变身成为假面骑士灰太狼', '灰太狼电视', '3999.90', 'images/demo8.jpg', '800', '3', '2022-06-15');
INSERT INTO `product_info` VALUES ('20', '拥有这部电视可以变身成为假面骑士红太狼', '红太狼电视', '8999.90', 'images/demo9.jpg', '800', '3', '2022-06-15');
INSERT INTO `product_info` VALUES ('21', '拥有这部电视可以变身成为假面骑士懒羊羊', '懒羊羊电视', '7999.90', 'images/demo10.jpg', '800', '3', '2022-06-15');
INSERT INTO `product_info` VALUES ('22', '拥有这部电视可以变身成为假面骑士潇洒哥', '潇洒哥电视', '7999.90', 'images/demo11.jpg', '800', '3', '2022-06-15');
INSERT INTO `product_info` VALUES ('23', '拥有这部电脑可以变身成为假面骑士拿破仑', '拿破仑电脑', '7999.90', 'images/demo6.jpg', '800', '2', '2022-06-15');
INSERT INTO `product_info` VALUES ('24', '拥有这部电视可以变身成为假面骑士大肥羊', '大肥羊电视', '7999.90', 'images/demo8.jpg', '800', '3', '2022-06-15');
INSERT INTO `product_info` VALUES ('25', '用于测试', '测试手机', '2999.90', 'images/demo.jpg', '300', '1', '2022-06-15');

-- ----------------------------
-- Table structure for product_type
-- ----------------------------
DROP TABLE IF EXISTS `product_type`;
CREATE TABLE `product_type` (
  `tid` int NOT NULL AUTO_INCREMENT,
  `tname` varchar(32) NOT NULL,
  PRIMARY KEY (`tid`),
  UNIQUE KEY `tname` (`tname`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb3;

-- ----------------------------
-- Records of product_type
-- ----------------------------
INSERT INTO `product_type` VALUES ('5', 'ipad');
INSERT INTO `product_type` VALUES ('1', '手机');
INSERT INTO `product_type` VALUES ('2', '电脑');
INSERT INTO `product_type` VALUES ('3', '电视');

-- ----------------------------
-- Table structure for user
-- ----------------------------
DROP TABLE IF EXISTS `user`;
CREATE TABLE `user` (
  `id` int NOT NULL AUTO_INCREMENT,
  `username` varchar(32) NOT NULL,
  `password` varchar(32) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb3;

-- ----------------------------
-- Records of user
-- ----------------------------
INSERT INTO `user` VALUES ('1', 'admin', 'admin');
